package main

import (
	"fmt"
	"io"
	"log"
	"net/http"

	"github.com/tidwall/gjson"
)

func main() {
	resp, err := http.Get("http://dog-api.kinduff.com/api/facts?number=1")
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()

	data, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}

	value := gjson.GetBytes(data, "facts.0")
	fmt.Println("Fact about dogs:", value)
}
